package com.orhonit.ipb.portal.biz;

import java.util.List;
import java.util.Map;

import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.netflix.discovery.converters.Auto;
import com.orhonit.ipb.portal.entity.BaseUserExtension;
import com.orhonit.ipb.portal.entity.JoApplyJoinParty;
import com.orhonit.ipb.portal.mapper.JoApplyJoinPartyMapper;
import com.orhonit.ipb.security.common.biz.BusinessBiz;


/**
 * 入党申请表
 *
 * @author 
 * @email 
 * @version 2018-05-22 08:50:05
 */
@Service
public class JoApplyJoinPartyBiz extends BusinessBiz<JoApplyJoinPartyMapper,JoApplyJoinParty> {
	
	@Autowired
	private JoApplyJoinPartyMapper joApplyJoinPartyMapper;
	
	public JoApplyJoinParty innitJoApplyJoinParty(String processInstance,String task,String businessKey){
		JoApplyJoinParty joApplyJoinParty=joApplyJoinPartyMapper.getJoApplyJoinPartyByid(businessKey);
		joApplyJoinParty.setProcessInstanceId(processInstance);
		joApplyJoinParty.setTaskId(task);
		return joApplyJoinParty;
	}
	
	/**
	 * 通过id查找信息
	 * @param id
	 * @return
	 */
	public JoApplyJoinParty getJoApplyJoinPartyByid(String id){
		return joApplyJoinPartyMapper.getJoApplyJoinPartyByid(id);
	}
	
	/**
	 * 通过id更新入党状态
	 * @param map
	 * @return
	 */
	@Transactional(rollbackFor = Exception.class)
	public boolean updatestatusByid(Map<String, Object> map){
		boolean a=false;
		int count=joApplyJoinPartyMapper.updatestatusByid(map);
		if(count>0){
			a=true;
		}
		return a;
	}
	/**
	 * 通过userid查找
	 * @param userId
	 * @return
	 */
	public String getJoApplyJoinPartyByUserId(String userId){
		return joApplyJoinPartyMapper.getJoApplyJoinPartyByUserId(userId);
	}
	/**
	 * 通过申请id查询支部信息
	 * @param id
	 * @return
	 */
	public JoApplyJoinParty getJoApplyJoinPartyByIDd(String id){
		return joApplyJoinPartyMapper.getJoApplyJoinPartyByIDd(id);
	}
	/**
	 * 通过部门id查找申请人
	 * @param id
	 * @return
	 */
	public List<JoApplyJoinParty> getJoApplyJoinPartyuserBydeptId(String id){
		return joApplyJoinPartyMapper.getJoApplyJoinPartyuserBydeptId(id);
	}
}